<template>
  <div class="app-container">
    <!-- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="学院高基ID" prop="baseCollegeId">
        <el-input
          v-model="queryParams.baseCollegeId"
          placeholder="请输入学院高基ID"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="学院代码" prop="orgCode">
        <el-input
          v-model="queryParams.orgCode"
          placeholder="请输入学院代码"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="实验室ID" prop="labId">
        <el-input
          v-model="queryParams.labId"
          placeholder="请输入实验室ID"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="实验室编号" prop="labCode">
        <el-input
          v-model="queryParams.labCode"
          placeholder="请输入实验室编号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="实验室名称" prop="labName">
        <el-input
          v-model="queryParams.labName"
          placeholder="请输入实验室名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="实验室类别" prop="labCategory">
        <el-input
          v-model="queryParams.labCategory"
          placeholder="请输入实验室类别"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="建立年份" prop="buildYear">
        <el-input
          v-model="queryParams.buildYear"
          placeholder="请输入建立年份"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="房屋使用面积" prop="usablearea">
        <el-input
          v-model="queryParams.usablearea"
          placeholder="请输入房屋使用面积"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="实验室类型" prop="labType">
        <el-select v-model="queryParams.labType" placeholder="请选择实验室类型" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="所属学科" prop="subject">
        <el-input
          v-model="queryParams.subject"
          placeholder="请输入所属学科"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="国家级获奖数" prop="nationalAwardsNumber">
        <el-input
          v-model="queryParams.nationalAwardsNumber"
          placeholder="请输入国家级获奖数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="省部级获奖数" prop="provincialAwardsNumber">
        <el-input
          v-model="queryParams.provincialAwardsNumber"
          placeholder="请输入省部级获奖数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="教师专利数" prop="teacherPatentNumber">
        <el-input
          v-model="queryParams.teacherPatentNumber"
          placeholder="请输入教师专利数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="学生获奖数" prop="studentAwardsNumber">
        <el-input
          v-model="queryParams.studentAwardsNumber"
          placeholder="请输入学生获奖数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="教学三大检索论文" prop="educationThreeRetrievalPapers">
        <el-input
          v-model="queryParams.educationThreeRetrievalPapers"
          placeholder="请输入教学三大检索论文"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="科研三大检索论文" prop="scientificThreeRetrievalPapers">
        <el-input
          v-model="queryParams.scientificThreeRetrievalPapers"
          placeholder="请输入科研三大检索论文"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="教学核心刊物论文" prop="educationCoreJournalPapers">
        <el-input
          v-model="queryParams.educationCoreJournalPapers"
          placeholder="请输入教学核心刊物论文"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="科研核心刊物论文" prop="scientificCoreJournalPapers">
        <el-input
          v-model="queryParams.scientificCoreJournalPapers"
          placeholder="请输入科研核心刊物论文"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="实验教材" prop="experimentalTextbook">
        <el-input
          v-model="queryParams.experimentalTextbook"
          placeholder="请输入实验教材"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="省部级以上科研项目数" prop="provincialScientificProjectNumber">
        <el-input
          v-model="queryParams.provincialScientificProjectNumber"
          placeholder="请输入省部级以上科研项目数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="其他科研项目数" prop="otherScientificProjectNumber">
        <el-input
          v-model="queryParams.otherScientificProjectNumber"
          placeholder="请输入其他科研项目数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="社会服务项目数" prop="socialServiceProjectNumber">
        <el-input
          v-model="queryParams.socialServiceProjectNumber"
          placeholder="请输入社会服务项目数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="省部级以上教研项目数" prop="provincialTeachProjectNumber">
        <el-input
          v-model="queryParams.provincialTeachProjectNumber"
          placeholder="请输入省部级以上教研项目数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="其他教研项目数" prop="otherTeachProjectNumber">
        <el-input
          v-model="queryParams.otherTeachProjectNumber"
          placeholder="请输入其他教研项目数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="专科生人数" prop="juniorCollegeStudentNumber">
        <el-input
          v-model="queryParams.juniorCollegeStudentNumber"
          placeholder="请输入专科生人数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="本科生人数" prop="undergraduateStudentNumber">
        <el-input
          v-model="queryParams.undergraduateStudentNumber"
          placeholder="请输入本科生人数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="研究生人数" prop="graduateStudentNumber">
        <el-input
          v-model="queryParams.graduateStudentNumber"
          placeholder="请输入研究生人数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="校内实验数量" prop="intramuralExperimentNumber">
        <el-input
          v-model="queryParams.intramuralExperimentNumber"
          placeholder="请输入校内实验数量"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="校外实验数量" prop="outsideSchoolExperimentNumber">
        <el-input
          v-model="queryParams.outsideSchoolExperimentNumber"
          placeholder="请输入校外实验数量"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="校内实验人数" prop="intramuralPersonNumber">
        <el-input
          v-model="queryParams.intramuralPersonNumber"
          placeholder="请输入校内实验人数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="校外实验人数" prop="outsideSchoolPersonNumber">
        <el-input
          v-model="queryParams.outsideSchoolPersonNumber"
          placeholder="请输入校外实验人数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="校内实验人时数" prop="intramuralPersonHours">
        <el-input
          v-model="queryParams.intramuralPersonHours"
          placeholder="请输入校内实验人时数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="校外实验人时数" prop="outsideSchoolPersonHours">
        <el-input
          v-model="queryParams.outsideSchoolPersonHours"
          placeholder="请输入校外实验人时数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="兼职人员数" prop="partTimePersonNumber">
        <el-input
          v-model="queryParams.partTimePersonNumber"
          placeholder="请输入兼职人员数"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="经费小计" prop="totalFunds">
        <el-input
          v-model="queryParams.totalFunds"
          placeholder="请输入经费小计"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="耗材消费" prop="materialConsumption">
        <el-input
          v-model="queryParams.materialConsumption"
          placeholder="请输入耗材消费"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form> -->

    <!-- <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['statistics:statisticsLaboratory:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['statistics:statisticsLaboratory:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['statistics:statisticsLaboratory:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['statistics:statisticsLaboratory:export']"
        >导出</el-button>
      </el-col>
	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row> -->

    <el-table v-loading="loading" :data="detailList" height="480px" @selection-change="handleSelectionChange">
      <!-- <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="主键" align="center" prop="id" />
      <el-table-column label="学院高基ID" align="center" prop="baseCollegeId" /> -->
      <el-table-column label="学院代码" align="left" width="120px" prop="orgCode" />
      <!-- <el-table-column label="实验室ID" align="center" prop="labId" /> -->
      <el-table-column label="实验室编号" align="left" width="120px" prop="labCode" />
      <el-table-column label="实验室名称" align="left" width="120px" prop="labName" />
      <el-table-column label="实验室类别" align="left" prop="labCategory" />
      <el-table-column label="建立年份" align="center" prop="buildYear" />
      <el-table-column label="房屋使用面积" align="center" prop="usablearea" />
      <el-table-column label="实验室类型" align="center" :formatter="labTypeFormat" />
      <el-table-column label="所属学科" align="center" prop="subject" />
      
      <el-table-column label="教师获奖与成果" align="center">
        <el-table-column label="国家级" align="center" prop="nationalAwardsNumber" />
        <el-table-column label="省部级" align="center" prop="provincialAwardsNumber" />
        <el-table-column label="发明专利" align="center" prop="teacherPatentNumber" />
      </el-table-column>
      <el-table-column label="学生获奖数" align="center" prop="studentAwardsNumber" />
      
      <el-table-column label="论文和教材情况" align="center">
        <el-table-column label="三大检索" align="center">
          <el-table-column label="教学" align="center" prop="educationThreeRetrievalPapers" />
          <el-table-column label="科研" align="center" prop="scientificThreeRetrievalPapers" />
        </el-table-column>
        <el-table-column label="核心刊物" align="center">
          <el-table-column label="教学" align="center" prop="educationCoreJournalPapers" />
          <el-table-column label="科研" align="center" prop="scientificCoreJournalPapers" />
        </el-table-column>
        <el-table-column label="实验教材" align="center" prop="experimentalTextbook" />
      </el-table-column>
      <el-table-column label="核心刊物" align="center">
        <el-table-column label="科研项目数" align="center">
          <el-table-column label="省部级以上" align="center" prop="provincialScientificProjectNumber" />
          <el-table-column label="其他" align="center" prop="otherScientificProjectNumber" />
        </el-table-column>
        <el-table-column label="社会服务项目数" align="center" prop="socialServiceProjectNumber" />
        <el-table-column label="教研项目数" align="center">
          <el-table-column label="省部级以上" align="center" prop="provincialTeachProjectNumber" />
          <el-table-column label="其他" align="center" prop="otherTeachProjectNumber" />
        </el-table-column>
      </el-table-column>
      <el-table-column label="毕业设计和论文人数" align="center">
        <el-table-column label="专科生人数" align="center" prop="juniorCollegeStudentNumber" />
        <el-table-column label="本科生人数" align="center" prop="undergraduateStudentNumber" />
        <el-table-column label="研究生人数" align="center" prop="graduateStudentNumber" />
      </el-table-column>
      <el-table-column label="开放实验" align="center">
        <el-table-column label="实验个数" align="center">
          <el-table-column label="校内" align="center" prop="intramuralExperimentNumber" />
          <el-table-column label="校外" align="center" prop="outsideSchoolExperimentNumber" />
        </el-table-column>
        <el-table-column label="实验人数" align="center">
          <el-table-column label="校内" align="center" prop="intramuralPersonNumber" />
          <el-table-column label="校外" align="center" prop="outsideSchoolPersonNumber" />
        </el-table-column>
        <el-table-column label="实验人时数" align="center">
          <el-table-column label="校内" align="center" prop="intramuralPersonHours" />
          <el-table-column label="校外" align="center" prop="outsideSchoolPersonHours" />
        </el-table-column>
      </el-table-column>
      <el-table-column label="兼职人员数" align="center" prop="partTimePersonNumber" />
      <el-table-column label="实验教学运行经费" align="center">
        <el-table-column label="小计" align="center" prop="totalFunds" />
        <el-table-column label="其中教学实验年材料消耗费" align="center" prop="materialConsumption" />
      </el-table-column>
      <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
          >修改</el-button>
          <!-- <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['statistics:statisticsLaboratory:remove']"
          >删除</el-button> -->
        </template>
      </el-table-column>
    </el-table>
    
    <!-- <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    /> -->

    <!-- 添加或修改实验室基本情况对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="form" :inline=true :model="form" :rules="rules" label-width="120px" style="height: 480px; overflow: auto;">
        <!-- <el-form-item label="学院高基ID" prop="baseCollegeId">
          <el-input v-model="form.baseCollegeId" placeholder="请输入学院高基ID" />
        </el-form-item> -->
        <el-form-item label="学院代码" prop="orgCode">
          <el-input v-model="form.orgCode" placeholder="请输入学院代码" disabled />
        </el-form-item>
        <!-- <el-form-item label="实验室ID" prop="labId">
          <el-input v-model="form.labId" placeholder="请输入实验室ID" />
        </el-form-item> -->
        <el-form-item label="实验室编号" prop="labCode">
          <el-input v-model="form.labCode" placeholder="请输入实验室编号" disabled />
        </el-form-item>
        <el-form-item label="实验室名称" prop="labName">
          <el-input v-model="form.labName" placeholder="请输入实验室名称" disabled />
        </el-form-item>
        <el-form-item label="实验室类别" prop="labCategory">
          <el-input v-model="form.labCategory" placeholder="请输入实验室类别" disabled/>
        </el-form-item>
        <el-form-item label="建立年份" prop="buildYear">
          <el-input v-model="form.buildYear" placeholder="请输入建立年份" disabled/>
        </el-form-item>
        <el-form-item label="房屋使用面积" prop="usablearea">
          <el-input v-model="form.usablearea" placeholder="请输入房屋使用面积" disabled/>
        </el-form-item>
        <el-form-item label="实验室类型" prop="labType" disabled>
          <el-select v-model="form.labType" placeholder="请选择实验室类型" disabled>
            <el-option v-for="item in labTypeOpt" :key="item.dictValue" :label="item.dictLabel" 
              :value="item.dictValue">
            </el-option>
          </el-select>
          <!-- <el-input :value="labTypeLabel" disabled/> -->
        </el-form-item>
        <el-form-item label="所属学科" prop="subject">
          <el-input v-model="form.subject" placeholder="请输入所属学科" disabled/>
        </el-form-item>
        <el-form-item label="国家级获奖数" prop="nationalAwardsNumber">
          <el-input v-model="form.nationalAwardsNumber" placeholder="请输入国家级获奖数" />
        </el-form-item>
        <el-form-item label="省部级获奖数" prop="provincialAwardsNumber">
          <el-input v-model="form.provincialAwardsNumber" placeholder="请输入省部级获奖数" />
        </el-form-item>
        <el-form-item label="教师专利数" prop="teacherPatentNumber">
          <el-input v-model="form.teacherPatentNumber" placeholder="请输入教师专利数" />
        </el-form-item>
        <el-form-item label="学生获奖数" prop="studentAwardsNumber">
          <el-input v-model="form.studentAwardsNumber" placeholder="请输入学生获奖数" />
        </el-form-item>
        <el-form-item label="教学三大检索论文" prop="educationThreeRetrievalPapers">
          <el-input v-model="form.educationThreeRetrievalPapers" placeholder="请输入教学三大检索论文" />
        </el-form-item>
        <el-form-item label="科研三大检索论文" prop="scientificThreeRetrievalPapers">
          <el-input v-model="form.scientificThreeRetrievalPapers" placeholder="请输入科研三大检索论文" />
        </el-form-item>
        <el-form-item label="教学核心刊物论文" prop="educationCoreJournalPapers">
          <el-input v-model="form.educationCoreJournalPapers" placeholder="请输入教学核心刊物论文" />
        </el-form-item>
        <el-form-item label="科研核心刊物论文" prop="scientificCoreJournalPapers">
          <el-input v-model="form.scientificCoreJournalPapers" placeholder="请输入科研核心刊物论文" />
        </el-form-item>
        <el-form-item label="实验教材" prop="experimentalTextbook">
          <el-input v-model="form.experimentalTextbook" placeholder="请输入实验教材" />
        </el-form-item>
        <el-form-item label="省部级以上科研项目数" prop="provincialScientificProjectNumber">
          <el-input v-model="form.provincialScientificProjectNumber" placeholder="请输入省部级以上科研项目数" />
        </el-form-item>
        <el-form-item label="其他科研项目数" prop="otherScientificProjectNumber">
          <el-input v-model="form.otherScientificProjectNumber" placeholder="请输入其他科研项目数" />
        </el-form-item>
        <el-form-item label="社会服务项目数" prop="socialServiceProjectNumber">
          <el-input v-model="form.socialServiceProjectNumber" placeholder="请输入社会服务项目数" />
        </el-form-item>
        <el-form-item label="省部级以上教研项目数" prop="provincialTeachProjectNumber">
          <el-input v-model="form.provincialTeachProjectNumber" placeholder="请输入省部级以上教研项目数" />
        </el-form-item>
        <el-form-item label="其他教研项目数" prop="otherTeachProjectNumber">
          <el-input v-model="form.otherTeachProjectNumber" placeholder="请输入其他教研项目数" />
        </el-form-item>
        <el-form-item label="专科生人数" prop="juniorCollegeStudentNumber">
          <el-input v-model="form.juniorCollegeStudentNumber" placeholder="请输入专科生人数" />
        </el-form-item>
        <el-form-item label="本科生人数" prop="undergraduateStudentNumber">
          <el-input v-model="form.undergraduateStudentNumber" placeholder="请输入本科生人数" />
        </el-form-item>
        <el-form-item label="研究生人数" prop="graduateStudentNumber">
          <el-input v-model="form.graduateStudentNumber" placeholder="请输入研究生人数" />
        </el-form-item>
        <el-form-item label="校内实验数量" prop="intramuralExperimentNumber">
          <el-input v-model="form.intramuralExperimentNumber" placeholder="请输入校内实验数量" />
        </el-form-item>
        <el-form-item label="校外实验数量" prop="outsideSchoolExperimentNumber">
          <el-input v-model="form.outsideSchoolExperimentNumber" placeholder="请输入校外实验数量" />
        </el-form-item>
        <el-form-item label="校内实验人数" prop="intramuralPersonNumber">
          <el-input v-model="form.intramuralPersonNumber" placeholder="请输入校内实验人数" />
        </el-form-item>
        <el-form-item label="校外实验人数" prop="outsideSchoolPersonNumber">
          <el-input v-model="form.outsideSchoolPersonNumber" placeholder="请输入校外实验人数" />
        </el-form-item>
        <el-form-item label="校内实验人时数" prop="intramuralPersonHours">
          <el-input v-model="form.intramuralPersonHours" placeholder="请输入校内实验人时数" />
        </el-form-item>
        <el-form-item label="校外实验人时数" prop="outsideSchoolPersonHours">
          <el-input v-model="form.outsideSchoolPersonHours" placeholder="请输入校外实验人时数" />
        </el-form-item>
        <el-form-item label="兼职人员数" prop="partTimePersonNumber">
          <el-input v-model="form.partTimePersonNumber" placeholder="请输入兼职人员数" />
        </el-form-item>
        <el-form-item label="经费小计" prop="totalFunds">
          <el-input v-model="form.totalFunds" placeholder="请输入经费小计" />
        </el-form-item>
        <el-form-item label="耗材消费" prop="materialConsumption">
          <el-input v-model="form.materialConsumption" placeholder="请输入耗材消费" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listLaboratory, getLaboratory, delLaboratory, addLaboratory, updateLaboratory, exportLaboratory } from "@/api/statistics/statisticsLaboratory";

export default {
  name: "StatisticsLaboratory",
  props: {
    detailList: Array
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 实验室基本情况表格数据
      statisticsLaboratoryList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        baseCollegeId: null,
        orgCode: null,
        labId: null,
        labCode: null,
        labName: null,
        labCategory: null,
        buildYear: null,
        usablearea: null,
        labType: null,
        subject: null,
        nationalAwardsNumber: null,
        provincialAwardsNumber: null,
        teacherPatentNumber: null,
        studentAwardsNumber: null,
        educationThreeRetrievalPapers: null,
        scientificThreeRetrievalPapers: null,
        educationCoreJournalPapers: null,
        scientificCoreJournalPapers: null,
        experimentalTextbook: null,
        provincialScientificProjectNumber: null,
        otherScientificProjectNumber: null,
        socialServiceProjectNumber: null,
        provincialTeachProjectNumber: null,
        otherTeachProjectNumber: null,
        juniorCollegeStudentNumber: null,
        undergraduateStudentNumber: null,
        graduateStudentNumber: null,
        intramuralExperimentNumber: null,
        outsideSchoolExperimentNumber: null,
        intramuralPersonNumber: null,
        outsideSchoolPersonNumber: null,
        intramuralPersonHours: null,
        outsideSchoolPersonHours: null,
        partTimePersonNumber: null,
        totalFunds: null,
        materialConsumption: null,
      },
      // 表单参数
      form: {},
      labTypeOpt: [],
      // 表单校验
      rules: {
        baseCollegeId: [
          { required: true, message: "学院高基ID不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
    // labTypeOpt
    this.getDicts("labTypeOpt ").then(response => {
      this.labTypeOpt = response.data;
    });
  },
  computed: {
    labTypeLabel() {
      return this.selectDictLabel(this.labTypeOpt, this.form.labType);
    },
  },
  methods: {
    // 性别字典翻译
    labTypeFormat(row, column) {
      return this.selectDictLabel(this.labTypeOpt, row.labType);
    },
    /** 查询实验室基本情况列表 */
    getList() {
      this.loading = true;
      listLaboratory(this.queryParams).then(response => {
        this.statisticsLaboratoryList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        baseCollegeId: null,
        orgCode: null,
        labId: null,
        labCode: null,
        labName: null,
        labCategory: null,
        buildYear: null,
        usablearea: null,
        labType: null,
        subject: null,
        nationalAwardsNumber: null,
        provincialAwardsNumber: null,
        teacherPatentNumber: null,
        studentAwardsNumber: null,
        educationThreeRetrievalPapers: null,
        scientificThreeRetrievalPapers: null,
        educationCoreJournalPapers: null,
        scientificCoreJournalPapers: null,
        experimentalTextbook: null,
        provincialScientificProjectNumber: null,
        otherScientificProjectNumber: null,
        socialServiceProjectNumber: null,
        provincialTeachProjectNumber: null,
        otherTeachProjectNumber: null,
        juniorCollegeStudentNumber: null,
        undergraduateStudentNumber: null,
        graduateStudentNumber: null,
        intramuralExperimentNumber: null,
        outsideSchoolExperimentNumber: null,
        intramuralPersonNumber: null,
        outsideSchoolPersonNumber: null,
        intramuralPersonHours: null,
        outsideSchoolPersonHours: null,
        partTimePersonNumber: null,
        totalFunds: null,
        materialConsumption: null,
        updateBy: null,
        updateTime: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加实验室基本情况";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getLaboratory(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改实验室基本情况";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateLaboratory(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
              this.$emit("refresh");
            });
          } else {
            addLaboratory(this.form).then(response => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认删除实验室基本情况编号为"' + ids + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delLaboratory(ids);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        })
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有实验室基本情况数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return exportLaboratory(queryParams);
        }).then(response => {
          this.download(response.msg);
        })
    }
  }
};
</script>
